﻿namespace Chain.IDAL
{
    using Chain.DBUtility;
    using Chain.Model;
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.SqlClient;
    using System.Text;

    public class SysParameter
    {
        public int Add(Chain.Model.SysParameter model)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("insert into SysParameter(");
            builder.Append("Pwd,MoneyAndPoint,AutoLevel,DegradeLevel,PastTime,RecommendPoint,PointPeriod,ExpensePrefix,GoodsExpensePrefix,TimeExpensePrefix,MemCountPrefix,MemRechargePrefix,GoodsInPrefix,GoodsAllotPrefix,MemDrawMoneyPrefix,MemPointChangePrefix,GiftExchangePrefix,AutoPrint,AccordPrint,PrintTitle,PrintFootNote,Sms,MoneySms,IsSmsShopName,SmsShopName,SmsSeries,SmsSerialPwd,DrawMoneyPercent,Tel,TelNoMember,IsStaff,StaffType,PointLevel,MMS,MMSSeries,MMSSerialPwd,IsPayCard,IsPayCash,IsPayBink,IsPayCoupon,RegNullPwd,EmailAdress,EmailPwd,EmailSMTP,StockCount,UnitList,WeiXinSMSVcode,IsAutoSendSMSByMemRegister,IsAutoSendMMSByMemRegister,IsAutoSendSMSByMemRecharge,IsAutoSendSMSByMemWithdraw,IsAutoSendSMSByMemGiftExchange,IsAutoSendSMSByMemPointChange,IsAutoSendSMSByCommodityConsumption,IsAutoSendSMSByFastConsumption,IsAutoSendSMSByMemRedTimes,IsAutoSendSMSByTimingConsumption,SellerAccount,PartnerID,PartnerKey,IsEditPwdNeedOldPwd,WeiXinType,WeiXinVerified,WeiXinToken,WeiXinEncodingAESKey,WeiXinShopName,WeiXinSalutatory,WeiXinAppID,WeiXinAppSecret,SignInPoint,IsMemRegisterStaff,IsMustSlotCard,StorageTimingPrefix,IsAutoSendSMSByStorageTiming,EnterpriseEmailPort,EnterpriseEmailDisplayName,EnterpriseEmailEnableSSL,EnterpriseEmailUseDefaultCredentials,IsEmail,IsEmailNotice,MemCountExpensePrefix,IsAutoSendSMSByMemPast,AutoSendSMSByMemPastForDay,IsAutoSendSMSByMemBirthday,AutoSendSMSByMemBirthdayForDay,IsStartWeiXin,IsStartTimingProject,IsStartMemCount,MarketingSMS,MarketingSmsSeries,MarketingSmsSerialPwd,Senseiccard,Contacticcard,EmailUserName,PointNumStr,PrintPreview,PrintPaperType,IsSendCard,ShopSmsManage,ShopPointManage,ShopSettlement,AutoBackupDB,AutoBackupDay,SystemDomain)");
            builder.Append(" values (");
            builder.Append("@Pwd,@MoneyAndPoint,@AutoLevel,@DegradeLevel,@PastTime,@RecommendPoint,@PointPeriod,@ExpensePrefix,@GoodsExpensePrefix,@TimeExpensePrefix,@MemCountPrefix,@MemRechargePrefix,@GoodsInPrefix,@GoodsAllotPrefix,@MemDrawMoneyPrefix,@MemPointChangePrefix,@GiftExchangePrefix,@AutoPrint,@AccordPrint,@PrintTitle,@PrintFootNote,@Sms,@MoneySms,@IsSmsShopName,@SmsShopName,@SmsSeries,@SmsSerialPwd,@DrawMoneyPercent,@Tel,@TelNoMember,@IsStaff,@StaffType,@PointLevel,@MMS,@MMSSeries,@MMSSerialPwd,@IsPayCard,@IsPayCash,@IsPayBink,@IsPayCoupon,@RegNullPwd,@EmailAdress,@EmailPwd,@EmailSMTP,@StockCount,@UnitList,@WeiXinSMSVcode,@IsAutoSendSMSByMemRegister,@IsAutoSendMMSByMemRegister,@IsAutoSendSMSByMemRecharge,@IsAutoSendSMSByMemWithdraw,@IsAutoSendSMSByMemGiftExchange,@IsAutoSendSMSByMemPointChange,@IsAutoSendSMSByCommodityConsumption,@IsAutoSendSMSByFastConsumption,@IsAutoSendSMSByMemRedTimes,@IsAutoSendSMSByTimingConsumption,@SellerAccount,@PartnerID,@PartnerKey,@IsEditPwdNeedOldPwd,@WeiXinType,@WeiXinVerified,@WeiXinToken,@WeiXinEncodingAESKey,@WeiXinShopName,@WeiXinSalutatory,@WeiXinAppID,@WeiXinAppSecret,@SignInPoint,@IsMemRegisterStaff,@IsMustSlotCard,@StorageTimingPrefix,@IsAutoSendSMSByStorageTiming,@EnterpriseEmailPort,@EnterpriseEmailDisplayName,@EnterpriseEmailEnableSSL,@EnterpriseEmailUseDefaultCredentials,@IsEmail,@IsEmailNotice,@MemCountExpensePrefix,@IsAutoSendSMSByMemPast,@AutoSendSMSByMemPastForDay,@IsAutoSendSMSByMemBirthday,@AutoSendSMSByMemBirthdayForDay,@IsStartWeiXin,@IsStartTimingProject,@IsStartMemCount,@MarketingSMS,@MarketingSmsSeries,@MarketingSmsSerialPwd,@Senseiccard,@Contacticcard,@EmailUserName,@PointNumStr,@PrintPreview,@PrintPaperType,@IsSendCard,@ShopSmsManage,@ShopPointManage,@ShopSettlement,@AutoBackupDB,@AutoBackupDay,@SystemDomain)");
            builder.Append(";select @@IDENTITY");
            SqlParameter[] cmdParms = new SqlParameter[] { 
                new SqlParameter("@Pwd", SqlDbType.Bit, 1), new SqlParameter("@MoneyAndPoint", SqlDbType.Bit, 1), new SqlParameter("@AutoLevel", SqlDbType.Bit, 1), new SqlParameter("@DegradeLevel", SqlDbType.Bit, 1), new SqlParameter("@PastTime", SqlDbType.Bit, 1), new SqlParameter("@RecommendPoint", SqlDbType.Int, 4), new SqlParameter("@PointPeriod", SqlDbType.Int, 4), new SqlParameter("@ExpensePrefix", SqlDbType.VarChar, 50), new SqlParameter("@GoodsExpensePrefix", SqlDbType.VarChar, 50), new SqlParameter("@TimeExpensePrefix", SqlDbType.VarChar, 50), new SqlParameter("@MemCountPrefix", SqlDbType.VarChar, 50), new SqlParameter("@MemRechargePrefix", SqlDbType.VarChar, 50), new SqlParameter("@GoodsInPrefix", SqlDbType.VarChar, 50), new SqlParameter("@GoodsAllotPrefix", SqlDbType.VarChar, 50), new SqlParameter("@MemDrawMoneyPrefix", SqlDbType.VarChar, 50), new SqlParameter("@MemPointChangePrefix", SqlDbType.VarChar, 50), 
                new SqlParameter("@GiftExchangePrefix", SqlDbType.VarChar, 50), new SqlParameter("@AutoPrint", SqlDbType.Bit, 1), new SqlParameter("@AccordPrint", SqlDbType.Bit, 1), new SqlParameter("@PrintTitle", SqlDbType.NVarChar, 100), new SqlParameter("@PrintFootNote", SqlDbType.NVarChar, 100), new SqlParameter("@Sms", SqlDbType.Bit, 1), new SqlParameter("@MoneySms", SqlDbType.Bit, 1), new SqlParameter("@IsSmsShopName", SqlDbType.Bit, 1), new SqlParameter("@SmsShopName", SqlDbType.NVarChar, 100), new SqlParameter("@SmsSeries", SqlDbType.VarChar, 50), new SqlParameter("@SmsSerialPwd", SqlDbType.VarChar, 50), new SqlParameter("@DrawMoneyPercent", SqlDbType.Decimal, 9), new SqlParameter("@Tel", SqlDbType.Bit, 1), new SqlParameter("@TelNoMember", SqlDbType.Bit, 1), new SqlParameter("@IsStaff", SqlDbType.Bit, 1), new SqlParameter("@StaffType", SqlDbType.Bit, 1), 
                new SqlParameter("@PointLevel", SqlDbType.Bit, 1), new SqlParameter("@MMS", SqlDbType.Bit, 1), new SqlParameter("@MMSSeries", SqlDbType.VarChar, 50), new SqlParameter("@MMSSerialPwd", SqlDbType.VarChar, 50), new SqlParameter("@IsPayCard", SqlDbType.Bit, 1), new SqlParameter("@IsPayCash", SqlDbType.Bit, 1), new SqlParameter("@IsPayBink", SqlDbType.Bit, 1), new SqlParameter("@IsPayCoupon", SqlDbType.Bit, 1), new SqlParameter("@RegNullPwd", SqlDbType.Bit, 1), new SqlParameter("@EmailAdress", SqlDbType.NVarChar, 100), new SqlParameter("@EmailPwd", SqlDbType.NVarChar, 100), new SqlParameter("@EmailSMTP", SqlDbType.NVarChar, 100), new SqlParameter("@StockCount", SqlDbType.Int, 4), new SqlParameter("@UnitList", SqlDbType.NVarChar, 200), new SqlParameter("@WeiXinSMSVcode", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByMemRegister", SqlDbType.Bit, 1), 
                new SqlParameter("@IsAutoSendMMSByMemRegister", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByMemRecharge", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByMemWithdraw", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByMemGiftExchange", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByMemPointChange", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByCommodityConsumption", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByFastConsumption", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByMemRedTimes", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByTimingConsumption", SqlDbType.Bit, 1), new SqlParameter("@SellerAccount", SqlDbType.VarChar, 50), new SqlParameter("@PartnerID", SqlDbType.VarChar, 50), new SqlParameter("@PartnerKey", SqlDbType.VarChar, 50), new SqlParameter("@IsEditPwdNeedOldPwd", SqlDbType.Bit, 1), new SqlParameter("@WeiXinType", SqlDbType.Bit, 1), new SqlParameter("@WeiXinVerified", SqlDbType.Bit, 1), new SqlParameter("@WeiXinToken", SqlDbType.NVarChar, 100), 
                new SqlParameter("@WeiXinEncodingAESKey", SqlDbType.NVarChar, 100), new SqlParameter("@WeiXinShopName", SqlDbType.NVarChar, 100), new SqlParameter("@WeiXinSalutatory", SqlDbType.NVarChar, 0x3e8), new SqlParameter("@WeiXinAppID", SqlDbType.NVarChar, 0x3e8), new SqlParameter("@WeiXinAppSecret", SqlDbType.NVarChar, 0x3e8), new SqlParameter("@SignInPoint", SqlDbType.Int, 4), new SqlParameter("@IsMemRegisterStaff", SqlDbType.Bit, 1), new SqlParameter("@IsMustSlotCard", SqlDbType.Bit, 1), new SqlParameter("@StorageTimingPrefix", SqlDbType.NVarChar, 50), new SqlParameter("@IsAutoSendSMSByStorageTiming", SqlDbType.Bit, 1), new SqlParameter("@EnterpriseEmailPort", SqlDbType.Int, 4), new SqlParameter("@EnterpriseEmailDisplayName", SqlDbType.NVarChar, 100), new SqlParameter("@EnterpriseEmailEnableSSL", SqlDbType.Bit, 1), new SqlParameter("@EnterpriseEmailUseDefaultCredentials", SqlDbType.Bit, 1), new SqlParameter("@IsEmail", SqlDbType.Bit, 1), new SqlParameter("@IsEmailNotice", SqlDbType.Bit, 1), 
                new SqlParameter("@MemCountExpensePrefix", SqlDbType.VarChar, 50), new SqlParameter("@IsAutoSendSMSByMemPast", SqlDbType.Bit, 1), new SqlParameter("@AutoSendSMSByMemPastForDay", SqlDbType.Int, 4), new SqlParameter("@IsAutoSendSMSByMemBirthday", SqlDbType.Bit, 1), new SqlParameter("@AutoSendSMSByMemBirthdayForDay", SqlDbType.Int, 4), new SqlParameter("@IsStartWeiXin", SqlDbType.Bit, 1), new SqlParameter("@IsStartTimingProject", SqlDbType.Bit, 1), new SqlParameter("@IsStartMemCount", SqlDbType.Bit, 1), new SqlParameter("@MarketingSMS", SqlDbType.Bit, 1), new SqlParameter("@MarketingSmsSeries", SqlDbType.VarChar, 50), new SqlParameter("@MarketingSmsSerialPwd", SqlDbType.VarChar, 50), new SqlParameter("@Senseiccard", SqlDbType.Bit, 1), new SqlParameter("@Contacticcard", SqlDbType.Bit, 1), new SqlParameter("@EmailUserName", SqlDbType.NVarChar, 50), new SqlParameter("@PointNumStr", SqlDbType.VarChar, 100), new SqlParameter("@PrintPreview", SqlDbType.Int, 4), 
                new SqlParameter("@PrintPaperType", SqlDbType.Int, 4), new SqlParameter("@IsSendCard", SqlDbType.Bit, 1), new SqlParameter("@ShopSmsManage", SqlDbType.Bit, 1), new SqlParameter("@ShopPointManage", SqlDbType.Bit, 1), new SqlParameter("@ShopSettlement", SqlDbType.Bit, 1), new SqlParameter("@AutoBackupDB", SqlDbType.Bit, 1), new SqlParameter("@AutoBackupDay", SqlDbType.Int, 4), new SqlParameter("@SystemDomain", SqlDbType.VarChar, 100)
             };
            cmdParms[0].Value = model.Pwd;
            cmdParms[1].Value = model.MoneyAndPoint;
            cmdParms[2].Value = model.AutoLevel;
            cmdParms[3].Value = model.DegradeLevel;
            cmdParms[4].Value = model.PastTime;
            cmdParms[5].Value = model.RecommendPoint;
            cmdParms[6].Value = model.PointPeriod;
            cmdParms[7].Value = model.ExpensePrefix;
            cmdParms[8].Value = model.GoodsExpensePrefix;
            cmdParms[9].Value = model.TimeExpensePrefix;
            cmdParms[10].Value = model.MemCountPrefix;
            cmdParms[11].Value = model.MemRechargePrefix;
            cmdParms[12].Value = model.GoodsInPrefix;
            cmdParms[13].Value = model.GoodsAllotPrefix;
            cmdParms[14].Value = model.MemDrawMoneyPrefix;
            cmdParms[15].Value = model.MemPointChangePrefix;
            cmdParms[0x10].Value = model.GiftExchangePrefix;
            cmdParms[0x11].Value = model.AutoPrint;
            cmdParms[0x12].Value = model.AccordPrint;
            cmdParms[0x13].Value = model.PrintTitle;
            cmdParms[20].Value = model.PrintFootNote;
            cmdParms[0x15].Value = model.Sms;
            cmdParms[0x16].Value = model.MoneySms;
            cmdParms[0x17].Value = model.IsSmsShopName;
            cmdParms[0x18].Value = model.SmsShopName;
            cmdParms[0x19].Value = model.SmsSeries;
            cmdParms[0x1a].Value = model.SmsSerialPwd;
            cmdParms[0x1b].Value = model.DrawMoneyPercent;
            cmdParms[0x1c].Value = model.Tel;
            cmdParms[0x1d].Value = model.TelNoMember;
            cmdParms[30].Value = model.IsStaff;
            cmdParms[0x1f].Value = model.StaffType;
            cmdParms[0x20].Value = model.PointLevel;
            cmdParms[0x21].Value = model.MMS;
            cmdParms[0x22].Value = model.MMSSeries;
            cmdParms[0x23].Value = model.MMSSerialPwd;
            cmdParms[0x24].Value = model.IsPayCard;
            cmdParms[0x25].Value = model.IsPayCash;
            cmdParms[0x26].Value = model.IsPayBink;
            cmdParms[0x27].Value = model.IsPayCoupon;
            cmdParms[40].Value = model.RegNullPwd;
            cmdParms[0x29].Value = model.EmailAdress;
            cmdParms[0x2a].Value = model.EmailPwd;
            cmdParms[0x2b].Value = model.EmailSMTP;
            cmdParms[0x2c].Value = model.StockCount;
            cmdParms[0x2d].Value = model.UnitList;
            cmdParms[0x2e].Value = model.WeiXinSMSVcode;
            cmdParms[0x2f].Value = model.IsAutoSendSMSByMemRegister;
            cmdParms[0x30].Value = model.IsAutoSendMMSByMemRegister;
            cmdParms[0x31].Value = model.IsAutoSendSMSByMemRecharge;
            cmdParms[50].Value = model.IsAutoSendSMSByMemWithdraw;
            cmdParms[0x33].Value = model.IsAutoSendSMSByMemGiftExchange;
            cmdParms[0x34].Value = model.IsAutoSendSMSByMemPointChange;
            cmdParms[0x35].Value = model.IsAutoSendSMSByCommodityConsumption;
            cmdParms[0x36].Value = model.IsAutoSendSMSByFastConsumption;
            cmdParms[0x37].Value = model.IsAutoSendSMSByMemRedTimes;
            cmdParms[0x38].Value = model.IsAutoSendSMSByTimingConsumption;
            cmdParms[0x39].Value = model.SellerAccount;
            cmdParms[0x3a].Value = model.PartnerID;
            cmdParms[0x3b].Value = model.PartnerKey;
            cmdParms[60].Value = model.IsEditPwdNeedOldPwd;
            cmdParms[0x3d].Value = model.WeiXinType;
            cmdParms[0x3e].Value = model.WeiXinVerified;
            cmdParms[0x3f].Value = model.WeiXinToken;
            cmdParms[0x40].Value = model.WeiXinEncodingAESKey;
            cmdParms[0x41].Value = model.WeiXinShopName;
            cmdParms[0x42].Value = model.WeiXinSalutatory;
            cmdParms[0x43].Value = model.WeiXinAppID;
            cmdParms[0x44].Value = model.WeiXinAppSecret;
            cmdParms[0x45].Value = model.SignInPoint;
            cmdParms[70].Value = model.IsMemRegisterStaff;
            cmdParms[0x47].Value = model.IsMustSlotCard;
            cmdParms[0x48].Value = model.StorageTimingPrefix;
            cmdParms[0x49].Value = model.IsAutoSendSMSByStorageTiming;
            cmdParms[0x4a].Value = model.EnterpriseEmailPort;
            cmdParms[0x4b].Value = model.EnterpriseEmailDisplayName;
            cmdParms[0x4c].Value = model.EnterpriseEmailEnableSSL;
            cmdParms[0x4d].Value = model.EnterpriseEmailUseDefaultCredentials;
            cmdParms[0x4e].Value = model.IsEmail;
            cmdParms[0x4f].Value = model.IsEmailNotice;
            cmdParms[80].Value = model.MemCountExpensePrefix;
            cmdParms[0x51].Value = model.IsAutoSendSMSByMemPast;
            cmdParms[0x52].Value = model.AutoSendSMSByMemPastForDay;
            cmdParms[0x53].Value = model.IsAutoSendSMSByMemBirthday;
            cmdParms[0x54].Value = model.AutoSendSMSByMemBirthdayForDay;
            cmdParms[0x55].Value = model.IsStartWeiXin;
            cmdParms[0x56].Value = model.IsStartTimingProject;
            cmdParms[0x57].Value = model.IsStartMemCount;
            cmdParms[0x58].Value = model.MarketingSMS;
            cmdParms[0x59].Value = model.MarketingSmsSeries;
            cmdParms[90].Value = model.MarketingSmsSerialPwd;
            cmdParms[0x5b].Value = model.Senseiccard;
            cmdParms[0x5c].Value = model.Contacticcard;
            cmdParms[0x5d].Value = model.EmailUserName;
            cmdParms[0x5e].Value = model.PointNumStr;
            cmdParms[0x5f].Value = model.PrintPreview;
            cmdParms[0x60].Value = model.PrintPaperType;
            cmdParms[0x61].Value = model.IsSendCard;
            cmdParms[0x62].Value = model.ShopSmsManage;
            cmdParms[0x63].Value = model.ShopPointManage;
            cmdParms[100].Value = model.ShopSettlement;
            cmdParms[0x65].Value = model.AutoBackupDB;
            cmdParms[0x66].Value = model.AutoBackupDay;
            cmdParms[0x67].Value = model.SystemDomain;
            object single = DbHelperSQL.GetSingle(builder.ToString(), cmdParms);
            if (single == null)
            {
                return 0;
            }
            return Convert.ToInt32(single);
        }

        public int DataBakUp(string FileName)
        {
            if (DbHelperSQL.DataBaseBackup(FileName))
            {
                return 1;
            }
            return 0;
        }

        public bool Delete(int ParameterID)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("delete from SysParameter ");
            builder.Append(" where ParameterID=@ParameterID");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@ParameterID", SqlDbType.Int, 4) };
            cmdParms[0].Value = ParameterID;
            return (DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }

        public bool DeleteList(string ParameterIDlist)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("delete from SysParameter ");
            builder.Append(" where ParameterID in (" + ParameterIDlist + ")  ");
            return (DbHelperSQL.ExecuteSql(builder.ToString()) > 0);
        }

        public bool Exists(int ParameterID)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("select count(1) from SysParameter");
            builder.Append(" where ParameterID=@ParameterID");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@ParameterID", SqlDbType.Int, 4) };
            cmdParms[0].Value = ParameterID;
            return DbHelperSQL.Exists(builder.ToString(), cmdParms);
        }

        public string GetDataBaseName()
        {
            return DbHelperSQL.GetDataBaseName();
        }

        public DataSet GetList(string strWhere)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("select ParameterID,Pwd,MoneyAndPoint,AutoLevel,DegradeLevel,PastTime,RecommendPoint,PointPeriod,ExpensePrefix,GoodsExpensePrefix,TimeExpensePrefix,MemCountPrefix,MemRechargePrefix,GoodsInPrefix,GoodsAllotPrefix,MemDrawMoneyPrefix,MemPointChangePrefix,GiftExchangePrefix,AutoPrint,AccordPrint,PrintTitle,PrintFootNote,Sms,MoneySms,IsSmsShopName,SmsShopName,SmsSeries,SmsSerialPwd,DrawMoneyPercent,Tel,TelNoMember,IsStaff,StaffType,PointLevel,MMS,MMSSeries,MMSSerialPwd,IsPayCard,IsPayCash,IsPayBink,IsPayCoupon,RegNullPwd,EmailAdress,EmailPwd,EmailSMTP,StockCount,UnitList,WeiXinSMSVcode,IsAutoSendSMSByMemRegister,IsAutoSendMMSByMemRegister,IsAutoSendSMSByMemRecharge,IsAutoSendSMSByMemWithdraw,IsAutoSendSMSByMemGiftExchange,IsAutoSendSMSByMemPointChange,IsAutoSendSMSByCommodityConsumption,IsAutoSendSMSByFastConsumption,IsAutoSendSMSByMemRedTimes,IsAutoSendSMSByTimingConsumption,SellerAccount,PartnerID,PartnerKey,IsEditPwdNeedOldPwd,WeiXinType,WeiXinVerified,WeiXinToken,WeiXinEncodingAESKey,WeiXinShopName,WeiXinSalutatory,WeiXinAppID,WeiXinAppSecret,SignInPoint,IsMemRegisterStaff,IsMustSlotCard,StorageTimingPrefix,IsAutoSendSMSByStorageTiming,EnterpriseEmailPort,EnterpriseEmailDisplayName,EnterpriseEmailEnableSSL,EnterpriseEmailUseDefaultCredentials,IsEmail,IsEmailNotice,MemCountExpensePrefix,IsAutoSendSMSByMemPast,AutoSendSMSByMemPastForDay,IsAutoSendSMSByMemBirthday,AutoSendSMSByMemBirthdayForDay,IsStartWeiXin,IsStartTimingProject,IsStartMemCount,MarketingSMS,MarketingSmsSeries,MarketingSmsSerialPwd,Senseiccard,Contacticcard,EmailUserName,PointNumStr,PrintPreview,PrintPaperType,IsSendCard,ShopSmsManage,ShopPointManage,ShopSettlement,AutoBackupDB,AutoBackupDay,SystemDomain ");
            builder.Append(" FROM SysParameter ");
            if (strWhere.Trim() != "")
            {
                builder.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(builder.ToString());
        }

        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("select ");
            if (Top > 0)
            {
                builder.Append(" top " + Top.ToString());
            }
            builder.Append(" ParameterID,Pwd,MoneyAndPoint,AutoLevel,DegradeLevel,PastTime,RecommendPoint,PointPeriod,ExpensePrefix,GoodsExpensePrefix,TimeExpensePrefix,MemCountPrefix,MemRechargePrefix,GoodsInPrefix,GoodsAllotPrefix,MemDrawMoneyPrefix,MemPointChangePrefix,GiftExchangePrefix,AutoPrint,AccordPrint,PrintTitle,PrintFootNote,Sms,MoneySms,IsSmsShopName,SmsShopName,SmsSeries,SmsSerialPwd,DrawMoneyPercent,Tel,TelNoMember,IsStaff,StaffType,PointLevel,MMS,MMSSeries,MMSSerialPwd,IsPayCard,IsPayCash,IsPayBink,IsPayCoupon,RegNullPwd,EmailAdress,EmailPwd,EmailSMTP,StockCount,UnitList,WeiXinSMSVcode,IsAutoSendSMSByMemRegister,IsAutoSendMMSByMemRegister,IsAutoSendSMSByMemRecharge,IsAutoSendSMSByMemWithdraw,IsAutoSendSMSByMemGiftExchange,IsAutoSendSMSByMemPointChange,IsAutoSendSMSByCommodityConsumption,IsAutoSendSMSByFastConsumption,IsAutoSendSMSByMemRedTimes,IsAutoSendSMSByTimingConsumption,SellerAccount,PartnerID,PartnerKey,IsEditPwdNeedOldPwd,WeiXinType,WeiXinVerified,WeiXinToken,WeiXinEncodingAESKey,WeiXinShopName,WeiXinSalutatory,WeiXinAppID,WeiXinAppSecret,SignInPoint,IsMemRegisterStaff,IsMustSlotCard,StorageTimingPrefix,IsAutoSendSMSByStorageTiming,EnterpriseEmailPort,EnterpriseEmailDisplayName,EnterpriseEmailEnableSSL,EnterpriseEmailUseDefaultCredentials,IsEmail,IsEmailNotice,MemCountExpensePrefix,IsAutoSendSMSByMemPast,AutoSendSMSByMemPastForDay,IsAutoSendSMSByMemBirthday,AutoSendSMSByMemBirthdayForDay,IsStartWeiXin,IsStartTimingProject,IsStartMemCount,MarketingSMS,MarketingSmsSeries,MarketingSmsSerialPwd,Senseiccard,Contacticcard,EmailUserName,PointNumStr,PrintPreview,PrintPaperType,IsSendCard,ShopSmsManage,ShopPointManage,ShopSettlement,AutoBackupDB,AutoBackupDay,SystemDomain ");
            builder.Append(" FROM SysParameter ");
            if (strWhere.Trim() != "")
            {
                builder.Append(" where " + strWhere);
            }
            builder.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(builder.ToString());
        }

        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("SELECT * FROM ( ");
            builder.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                builder.Append("order by T." + orderby);
            }
            else
            {
                builder.Append("order by T.ParameterID desc");
            }
            builder.Append(")AS Row, T.*  from SysParameter T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                builder.Append(" WHERE " + strWhere);
            }
            builder.Append(" ) TT");
            builder.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return DbHelperSQL.Query(builder.ToString());
        }

        public int GetMaxId()
        {
            return DbHelperSQL.GetMaxID("ParameterID", "SysParameter");
        }

        public Chain.Model.SysParameter GetModel(int ParameterID)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("select  top 1 ParameterID,Pwd,MoneyAndPoint,AutoLevel,DegradeLevel,PastTime,RecommendPoint,PointPeriod,ExpensePrefix,GoodsExpensePrefix,TimeExpensePrefix,MemCountPrefix,MemRechargePrefix,GoodsInPrefix,GoodsAllotPrefix,MemDrawMoneyPrefix,MemPointChangePrefix,GiftExchangePrefix,AutoPrint,AccordPrint,PrintTitle,PrintFootNote,Sms,MoneySms,IsSmsShopName,SmsShopName,SmsSeries,SmsSerialPwd,DrawMoneyPercent,Tel,TelNoMember,IsStaff,StaffType,PointLevel,MMS,MMSSeries,MMSSerialPwd,IsPayCard,IsPayCash,IsPayBink,IsPayCoupon,RegNullPwd,EmailAdress,EmailPwd,EmailSMTP,StockCount,UnitList,WeiXinSMSVcode,IsAutoSendSMSByMemRegister,IsAutoSendMMSByMemRegister,IsAutoSendSMSByMemRecharge,IsAutoSendSMSByMemWithdraw,IsAutoSendSMSByMemGiftExchange,IsAutoSendSMSByMemPointChange,IsAutoSendSMSByCommodityConsumption,IsAutoSendSMSByFastConsumption,IsAutoSendSMSByMemRedTimes,IsAutoSendSMSByTimingConsumption,SellerAccount,PartnerID,PartnerKey,IsEditPwdNeedOldPwd,WeiXinType,WeiXinVerified,WeiXinToken,WeiXinEncodingAESKey,WeiXinShopName,WeiXinSalutatory,WeiXinAppID,WeiXinAppSecret,SignInPoint,IsMemRegisterStaff,IsMustSlotCard,StorageTimingPrefix,IsAutoSendSMSByStorageTiming,EnterpriseEmailPort,EnterpriseEmailDisplayName,EnterpriseEmailEnableSSL,EnterpriseEmailUseDefaultCredentials,IsEmail,IsEmailNotice,MemCountExpensePrefix,IsAutoSendSMSByMemPast,AutoSendSMSByMemPastForDay,IsAutoSendSMSByMemBirthday,AutoSendSMSByMemBirthdayForDay,IsStartWeiXin,IsStartTimingProject,IsStartMemCount,MarketingSMS,MarketingSmsSeries,MarketingSmsSerialPwd,Senseiccard,Contacticcard,EmailUserName,PointNumStr,PrintPreview,PrintPaperType,IsSendCard,ShopSmsManage,ShopPointManage,ShopSettlement,AutoBackupDB,AutoBackupDay,SystemDomain from SysParameter ");
            builder.Append(" where ParameterID=@ParameterID");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@ParameterID", SqlDbType.Int, 4) };
            cmdParms[0].Value = ParameterID;
            Chain.Model.SysParameter parameter = new Chain.Model.SysParameter();
            DataSet set = DbHelperSQL.Query(builder.ToString(), cmdParms);
            if (set.Tables[0].Rows.Count <= 0)
            {
                return null;
            }
            if ((set.Tables[0].Rows[0]["ParameterID"] != null) && (set.Tables[0].Rows[0]["ParameterID"].ToString() != ""))
            {
                parameter.ParameterID = int.Parse(set.Tables[0].Rows[0]["ParameterID"].ToString());
            }
            if ((set.Tables[0].Rows[0]["Pwd"] != null) && (set.Tables[0].Rows[0]["Pwd"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["Pwd"].ToString() == "1") || (set.Tables[0].Rows[0]["Pwd"].ToString().ToLower() == "true"))
                {
                    parameter.Pwd = true;
                }
                else
                {
                    parameter.Pwd = false;
                }
            }
            if ((set.Tables[0].Rows[0]["MoneyAndPoint"] != null) && (set.Tables[0].Rows[0]["MoneyAndPoint"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["MoneyAndPoint"].ToString() == "1") || (set.Tables[0].Rows[0]["MoneyAndPoint"].ToString().ToLower() == "true"))
                {
                    parameter.MoneyAndPoint = true;
                }
                else
                {
                    parameter.MoneyAndPoint = false;
                }
            }
            if ((set.Tables[0].Rows[0]["AutoLevel"] != null) && (set.Tables[0].Rows[0]["AutoLevel"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["AutoLevel"].ToString() == "1") || (set.Tables[0].Rows[0]["AutoLevel"].ToString().ToLower() == "true"))
                {
                    parameter.AutoLevel = true;
                }
                else
                {
                    parameter.AutoLevel = false;
                }
            }
            if ((set.Tables[0].Rows[0]["DegradeLevel"] != null) && (set.Tables[0].Rows[0]["DegradeLevel"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["DegradeLevel"].ToString() == "1") || (set.Tables[0].Rows[0]["DegradeLevel"].ToString().ToLower() == "true"))
                {
                    parameter.DegradeLevel = true;
                }
                else
                {
                    parameter.DegradeLevel = false;
                }
            }
            if ((set.Tables[0].Rows[0]["PastTime"] != null) && (set.Tables[0].Rows[0]["PastTime"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["PastTime"].ToString() == "1") || (set.Tables[0].Rows[0]["PastTime"].ToString().ToLower() == "true"))
                {
                    parameter.PastTime = true;
                }
                else
                {
                    parameter.PastTime = false;
                }
            }
            if ((set.Tables[0].Rows[0]["RecommendPoint"] != null) && (set.Tables[0].Rows[0]["RecommendPoint"].ToString() != ""))
            {
                parameter.RecommendPoint = int.Parse(set.Tables[0].Rows[0]["RecommendPoint"].ToString());
            }
            if ((set.Tables[0].Rows[0]["PointPeriod"] != null) && (set.Tables[0].Rows[0]["PointPeriod"].ToString() != ""))
            {
                parameter.PointPeriod = int.Parse(set.Tables[0].Rows[0]["PointPeriod"].ToString());
            }
            if ((set.Tables[0].Rows[0]["ExpensePrefix"] != null) && (set.Tables[0].Rows[0]["ExpensePrefix"].ToString() != ""))
            {
                parameter.ExpensePrefix = set.Tables[0].Rows[0]["ExpensePrefix"].ToString();
            }
            if ((set.Tables[0].Rows[0]["GoodsExpensePrefix"] != null) && (set.Tables[0].Rows[0]["GoodsExpensePrefix"].ToString() != ""))
            {
                parameter.GoodsExpensePrefix = set.Tables[0].Rows[0]["GoodsExpensePrefix"].ToString();
            }
            if ((set.Tables[0].Rows[0]["TimeExpensePrefix"] != null) && (set.Tables[0].Rows[0]["TimeExpensePrefix"].ToString() != ""))
            {
                parameter.TimeExpensePrefix = set.Tables[0].Rows[0]["TimeExpensePrefix"].ToString();
            }
            if ((set.Tables[0].Rows[0]["MemCountPrefix"] != null) && (set.Tables[0].Rows[0]["MemCountPrefix"].ToString() != ""))
            {
                parameter.MemCountPrefix = set.Tables[0].Rows[0]["MemCountPrefix"].ToString();
            }
            if ((set.Tables[0].Rows[0]["MemRechargePrefix"] != null) && (set.Tables[0].Rows[0]["MemRechargePrefix"].ToString() != ""))
            {
                parameter.MemRechargePrefix = set.Tables[0].Rows[0]["MemRechargePrefix"].ToString();
            }
            if ((set.Tables[0].Rows[0]["GoodsInPrefix"] != null) && (set.Tables[0].Rows[0]["GoodsInPrefix"].ToString() != ""))
            {
                parameter.GoodsInPrefix = set.Tables[0].Rows[0]["GoodsInPrefix"].ToString();
            }
            if ((set.Tables[0].Rows[0]["GoodsAllotPrefix"] != null) && (set.Tables[0].Rows[0]["GoodsAllotPrefix"].ToString() != ""))
            {
                parameter.GoodsAllotPrefix = set.Tables[0].Rows[0]["GoodsAllotPrefix"].ToString();
            }
            if ((set.Tables[0].Rows[0]["MemDrawMoneyPrefix"] != null) && (set.Tables[0].Rows[0]["MemDrawMoneyPrefix"].ToString() != ""))
            {
                parameter.MemDrawMoneyPrefix = set.Tables[0].Rows[0]["MemDrawMoneyPrefix"].ToString();
            }
            if ((set.Tables[0].Rows[0]["MemPointChangePrefix"] != null) && (set.Tables[0].Rows[0]["MemPointChangePrefix"].ToString() != ""))
            {
                parameter.MemPointChangePrefix = set.Tables[0].Rows[0]["MemPointChangePrefix"].ToString();
            }
            if ((set.Tables[0].Rows[0]["GiftExchangePrefix"] != null) && (set.Tables[0].Rows[0]["GiftExchangePrefix"].ToString() != ""))
            {
                parameter.GiftExchangePrefix = set.Tables[0].Rows[0]["GiftExchangePrefix"].ToString();
            }
            if ((set.Tables[0].Rows[0]["AutoPrint"] != null) && (set.Tables[0].Rows[0]["AutoPrint"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["AutoPrint"].ToString() == "1") || (set.Tables[0].Rows[0]["AutoPrint"].ToString().ToLower() == "true"))
                {
                    parameter.AutoPrint = true;
                }
                else
                {
                    parameter.AutoPrint = false;
                }
            }
            if ((set.Tables[0].Rows[0]["AccordPrint"] != null) && (set.Tables[0].Rows[0]["AccordPrint"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["AccordPrint"].ToString() == "1") || (set.Tables[0].Rows[0]["AccordPrint"].ToString().ToLower() == "true"))
                {
                    parameter.AccordPrint = true;
                }
                else
                {
                    parameter.AccordPrint = false;
                }
            }
            if ((set.Tables[0].Rows[0]["PrintTitle"] != null) && (set.Tables[0].Rows[0]["PrintTitle"].ToString() != ""))
            {
                parameter.PrintTitle = set.Tables[0].Rows[0]["PrintTitle"].ToString();
            }
            if ((set.Tables[0].Rows[0]["PrintFootNote"] != null) && (set.Tables[0].Rows[0]["PrintFootNote"].ToString() != ""))
            {
                parameter.PrintFootNote = set.Tables[0].Rows[0]["PrintFootNote"].ToString();
            }
            if ((set.Tables[0].Rows[0]["Sms"] != null) && (set.Tables[0].Rows[0]["Sms"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["Sms"].ToString() == "1") || (set.Tables[0].Rows[0]["Sms"].ToString().ToLower() == "true"))
                {
                    parameter.Sms = true;
                }
                else
                {
                    parameter.Sms = false;
                }
            }
            if ((set.Tables[0].Rows[0]["MoneySms"] != null) && (set.Tables[0].Rows[0]["MoneySms"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["MoneySms"].ToString() == "1") || (set.Tables[0].Rows[0]["MoneySms"].ToString().ToLower() == "true"))
                {
                    parameter.MoneySms = true;
                }
                else
                {
                    parameter.MoneySms = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsSmsShopName"] != null) && (set.Tables[0].Rows[0]["IsSmsShopName"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsSmsShopName"].ToString() == "1") || (set.Tables[0].Rows[0]["IsSmsShopName"].ToString().ToLower() == "true"))
                {
                    parameter.IsSmsShopName = true;
                }
                else
                {
                    parameter.IsSmsShopName = false;
                }
            }
            if ((set.Tables[0].Rows[0]["SmsShopName"] != null) && (set.Tables[0].Rows[0]["SmsShopName"].ToString() != ""))
            {
                parameter.SmsShopName = set.Tables[0].Rows[0]["SmsShopName"].ToString();
            }
            if ((set.Tables[0].Rows[0]["SmsSeries"] != null) && (set.Tables[0].Rows[0]["SmsSeries"].ToString() != ""))
            {
                parameter.SmsSeries = set.Tables[0].Rows[0]["SmsSeries"].ToString();
            }
            if ((set.Tables[0].Rows[0]["SmsSerialPwd"] != null) && (set.Tables[0].Rows[0]["SmsSerialPwd"].ToString() != ""))
            {
                parameter.SmsSerialPwd = set.Tables[0].Rows[0]["SmsSerialPwd"].ToString();
            }
            if ((set.Tables[0].Rows[0]["DrawMoneyPercent"] != null) && (set.Tables[0].Rows[0]["DrawMoneyPercent"].ToString() != ""))
            {
                parameter.DrawMoneyPercent = decimal.Parse(set.Tables[0].Rows[0]["DrawMoneyPercent"].ToString());
            }
            if ((set.Tables[0].Rows[0]["Tel"] != null) && (set.Tables[0].Rows[0]["Tel"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["Tel"].ToString() == "1") || (set.Tables[0].Rows[0]["Tel"].ToString().ToLower() == "true"))
                {
                    parameter.Tel = true;
                }
                else
                {
                    parameter.Tel = false;
                }
            }
            if ((set.Tables[0].Rows[0]["TelNoMember"] != null) && (set.Tables[0].Rows[0]["TelNoMember"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["TelNoMember"].ToString() == "1") || (set.Tables[0].Rows[0]["TelNoMember"].ToString().ToLower() == "true"))
                {
                    parameter.TelNoMember = true;
                }
                else
                {
                    parameter.TelNoMember = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsStaff"] != null) && (set.Tables[0].Rows[0]["IsStaff"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsStaff"].ToString() == "1") || (set.Tables[0].Rows[0]["IsStaff"].ToString().ToLower() == "true"))
                {
                    parameter.IsStaff = true;
                }
                else
                {
                    parameter.IsStaff = false;
                }
            }
            if ((set.Tables[0].Rows[0]["StaffType"] != null) && (set.Tables[0].Rows[0]["StaffType"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["StaffType"].ToString() == "1") || (set.Tables[0].Rows[0]["StaffType"].ToString().ToLower() == "true"))
                {
                    parameter.StaffType = true;
                }
                else
                {
                    parameter.StaffType = false;
                }
            }
            if ((set.Tables[0].Rows[0]["PointLevel"] != null) && (set.Tables[0].Rows[0]["PointLevel"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["PointLevel"].ToString() == "1") || (set.Tables[0].Rows[0]["PointLevel"].ToString().ToLower() == "true"))
                {
                    parameter.PointLevel = true;
                }
                else
                {
                    parameter.PointLevel = false;
                }
            }
            if ((set.Tables[0].Rows[0]["MMS"] != null) && (set.Tables[0].Rows[0]["MMS"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["MMS"].ToString() == "1") || (set.Tables[0].Rows[0]["MMS"].ToString().ToLower() == "true"))
                {
                    parameter.MMS = true;
                }
                else
                {
                    parameter.MMS = false;
                }
            }
            if ((set.Tables[0].Rows[0]["MMSSeries"] != null) && (set.Tables[0].Rows[0]["MMSSeries"].ToString() != ""))
            {
                parameter.MMSSeries = set.Tables[0].Rows[0]["MMSSeries"].ToString();
            }
            if ((set.Tables[0].Rows[0]["MMSSerialPwd"] != null) && (set.Tables[0].Rows[0]["MMSSerialPwd"].ToString() != ""))
            {
                parameter.MMSSerialPwd = set.Tables[0].Rows[0]["MMSSerialPwd"].ToString();
            }
            if ((set.Tables[0].Rows[0]["IsPayCard"] != null) && (set.Tables[0].Rows[0]["IsPayCard"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsPayCard"].ToString() == "1") || (set.Tables[0].Rows[0]["IsPayCard"].ToString().ToLower() == "true"))
                {
                    parameter.IsPayCard = true;
                }
                else
                {
                    parameter.IsPayCard = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsPayCash"] != null) && (set.Tables[0].Rows[0]["IsPayCash"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsPayCash"].ToString() == "1") || (set.Tables[0].Rows[0]["IsPayCash"].ToString().ToLower() == "true"))
                {
                    parameter.IsPayCash = true;
                }
                else
                {
                    parameter.IsPayCash = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsPayBink"] != null) && (set.Tables[0].Rows[0]["IsPayBink"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsPayBink"].ToString() == "1") || (set.Tables[0].Rows[0]["IsPayBink"].ToString().ToLower() == "true"))
                {
                    parameter.IsPayBink = true;
                }
                else
                {
                    parameter.IsPayBink = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsPayCoupon"] != null) && (set.Tables[0].Rows[0]["IsPayCoupon"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsPayCoupon"].ToString() == "1") || (set.Tables[0].Rows[0]["IsPayCoupon"].ToString().ToLower() == "true"))
                {
                    parameter.IsPayCoupon = true;
                }
                else
                {
                    parameter.IsPayCoupon = false;
                }
            }
            if ((set.Tables[0].Rows[0]["RegNullPwd"] != null) && (set.Tables[0].Rows[0]["RegNullPwd"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["RegNullPwd"].ToString() == "1") || (set.Tables[0].Rows[0]["RegNullPwd"].ToString().ToLower() == "true"))
                {
                    parameter.RegNullPwd = true;
                }
                else
                {
                    parameter.RegNullPwd = false;
                }
            }
            if ((set.Tables[0].Rows[0]["EmailAdress"] != null) && (set.Tables[0].Rows[0]["EmailAdress"].ToString() != ""))
            {
                parameter.EmailAdress = set.Tables[0].Rows[0]["EmailAdress"].ToString();
            }
            if ((set.Tables[0].Rows[0]["EmailPwd"] != null) && (set.Tables[0].Rows[0]["EmailPwd"].ToString() != ""))
            {
                parameter.EmailPwd = set.Tables[0].Rows[0]["EmailPwd"].ToString();
            }
            if ((set.Tables[0].Rows[0]["EmailSMTP"] != null) && (set.Tables[0].Rows[0]["EmailSMTP"].ToString() != ""))
            {
                parameter.EmailSMTP = set.Tables[0].Rows[0]["EmailSMTP"].ToString();
            }
            if ((set.Tables[0].Rows[0]["StockCount"] != null) && (set.Tables[0].Rows[0]["StockCount"].ToString() != ""))
            {
                parameter.StockCount = int.Parse(set.Tables[0].Rows[0]["StockCount"].ToString());
            }
            if ((set.Tables[0].Rows[0]["UnitList"] != null) && (set.Tables[0].Rows[0]["UnitList"].ToString() != ""))
            {
                parameter.UnitList = set.Tables[0].Rows[0]["UnitList"].ToString();
            }
            if ((set.Tables[0].Rows[0]["WeiXinSMSVcode"] != null) && (set.Tables[0].Rows[0]["WeiXinSMSVcode"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["WeiXinSMSVcode"].ToString() == "1") || (set.Tables[0].Rows[0]["WeiXinSMSVcode"].ToString().ToLower() == "true"))
                {
                    parameter.WeiXinSMSVcode = true;
                }
                else
                {
                    parameter.WeiXinSMSVcode = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsAutoSendSMSByMemRegister"] != null) && (set.Tables[0].Rows[0]["IsAutoSendSMSByMemRegister"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsAutoSendSMSByMemRegister"].ToString() == "1") || (set.Tables[0].Rows[0]["IsAutoSendSMSByMemRegister"].ToString().ToLower() == "true"))
                {
                    parameter.IsAutoSendSMSByMemRegister = true;
                }
                else
                {
                    parameter.IsAutoSendSMSByMemRegister = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsAutoSendMMSByMemRegister"] != null) && (set.Tables[0].Rows[0]["IsAutoSendMMSByMemRegister"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsAutoSendMMSByMemRegister"].ToString() == "1") || (set.Tables[0].Rows[0]["IsAutoSendMMSByMemRegister"].ToString().ToLower() == "true"))
                {
                    parameter.IsAutoSendMMSByMemRegister = true;
                }
                else
                {
                    parameter.IsAutoSendMMSByMemRegister = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsAutoSendSMSByMemRecharge"] != null) && (set.Tables[0].Rows[0]["IsAutoSendSMSByMemRecharge"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsAutoSendSMSByMemRecharge"].ToString() == "1") || (set.Tables[0].Rows[0]["IsAutoSendSMSByMemRecharge"].ToString().ToLower() == "true"))
                {
                    parameter.IsAutoSendSMSByMemRecharge = true;
                }
                else
                {
                    parameter.IsAutoSendSMSByMemRecharge = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsAutoSendSMSByMemWithdraw"] != null) && (set.Tables[0].Rows[0]["IsAutoSendSMSByMemWithdraw"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsAutoSendSMSByMemWithdraw"].ToString() == "1") || (set.Tables[0].Rows[0]["IsAutoSendSMSByMemWithdraw"].ToString().ToLower() == "true"))
                {
                    parameter.IsAutoSendSMSByMemWithdraw = true;
                }
                else
                {
                    parameter.IsAutoSendSMSByMemWithdraw = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsAutoSendSMSByMemGiftExchange"] != null) && (set.Tables[0].Rows[0]["IsAutoSendSMSByMemGiftExchange"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsAutoSendSMSByMemGiftExchange"].ToString() == "1") || (set.Tables[0].Rows[0]["IsAutoSendSMSByMemGiftExchange"].ToString().ToLower() == "true"))
                {
                    parameter.IsAutoSendSMSByMemGiftExchange = true;
                }
                else
                {
                    parameter.IsAutoSendSMSByMemGiftExchange = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsAutoSendSMSByMemPointChange"] != null) && (set.Tables[0].Rows[0]["IsAutoSendSMSByMemPointChange"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsAutoSendSMSByMemPointChange"].ToString() == "1") || (set.Tables[0].Rows[0]["IsAutoSendSMSByMemPointChange"].ToString().ToLower() == "true"))
                {
                    parameter.IsAutoSendSMSByMemPointChange = true;
                }
                else
                {
                    parameter.IsAutoSendSMSByMemPointChange = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsAutoSendSMSByCommodityConsumption"] != null) && (set.Tables[0].Rows[0]["IsAutoSendSMSByCommodityConsumption"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsAutoSendSMSByCommodityConsumption"].ToString() == "1") || (set.Tables[0].Rows[0]["IsAutoSendSMSByCommodityConsumption"].ToString().ToLower() == "true"))
                {
                    parameter.IsAutoSendSMSByCommodityConsumption = true;
                }
                else
                {
                    parameter.IsAutoSendSMSByCommodityConsumption = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsAutoSendSMSByFastConsumption"] != null) && (set.Tables[0].Rows[0]["IsAutoSendSMSByFastConsumption"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsAutoSendSMSByFastConsumption"].ToString() == "1") || (set.Tables[0].Rows[0]["IsAutoSendSMSByFastConsumption"].ToString().ToLower() == "true"))
                {
                    parameter.IsAutoSendSMSByFastConsumption = true;
                }
                else
                {
                    parameter.IsAutoSendSMSByFastConsumption = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsAutoSendSMSByMemRedTimes"] != null) && (set.Tables[0].Rows[0]["IsAutoSendSMSByMemRedTimes"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsAutoSendSMSByMemRedTimes"].ToString() == "1") || (set.Tables[0].Rows[0]["IsAutoSendSMSByMemRedTimes"].ToString().ToLower() == "true"))
                {
                    parameter.IsAutoSendSMSByMemRedTimes = true;
                }
                else
                {
                    parameter.IsAutoSendSMSByMemRedTimes = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsAutoSendSMSByTimingConsumption"] != null) && (set.Tables[0].Rows[0]["IsAutoSendSMSByTimingConsumption"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsAutoSendSMSByTimingConsumption"].ToString() == "1") || (set.Tables[0].Rows[0]["IsAutoSendSMSByTimingConsumption"].ToString().ToLower() == "true"))
                {
                    parameter.IsAutoSendSMSByTimingConsumption = true;
                }
                else
                {
                    parameter.IsAutoSendSMSByTimingConsumption = false;
                }
            }
            if ((set.Tables[0].Rows[0]["SellerAccount"] != null) && (set.Tables[0].Rows[0]["SellerAccount"].ToString() != ""))
            {
                parameter.SellerAccount = set.Tables[0].Rows[0]["SellerAccount"].ToString();
            }
            if ((set.Tables[0].Rows[0]["PartnerID"] != null) && (set.Tables[0].Rows[0]["PartnerID"].ToString() != ""))
            {
                parameter.PartnerID = set.Tables[0].Rows[0]["PartnerID"].ToString();
            }
            if ((set.Tables[0].Rows[0]["PartnerKey"] != null) && (set.Tables[0].Rows[0]["PartnerKey"].ToString() != ""))
            {
                parameter.PartnerKey = set.Tables[0].Rows[0]["PartnerKey"].ToString();
            }
            if ((set.Tables[0].Rows[0]["IsEditPwdNeedOldPwd"] != null) && (set.Tables[0].Rows[0]["IsEditPwdNeedOldPwd"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsEditPwdNeedOldPwd"].ToString() == "1") || (set.Tables[0].Rows[0]["IsEditPwdNeedOldPwd"].ToString().ToLower() == "true"))
                {
                    parameter.IsEditPwdNeedOldPwd = true;
                }
                else
                {
                    parameter.IsEditPwdNeedOldPwd = false;
                }
            }
            if ((set.Tables[0].Rows[0]["WeiXinType"] != null) && (set.Tables[0].Rows[0]["WeiXinType"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["WeiXinType"].ToString() == "1") || (set.Tables[0].Rows[0]["WeiXinType"].ToString().ToLower() == "true"))
                {
                    parameter.WeiXinType = true;
                }
                else
                {
                    parameter.WeiXinType = false;
                }
            }
            if ((set.Tables[0].Rows[0]["WeiXinVerified"] != null) && (set.Tables[0].Rows[0]["WeiXinVerified"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["WeiXinVerified"].ToString() == "1") || (set.Tables[0].Rows[0]["WeiXinVerified"].ToString().ToLower() == "true"))
                {
                    parameter.WeiXinVerified = true;
                }
                else
                {
                    parameter.WeiXinVerified = false;
                }
            }
            if ((set.Tables[0].Rows[0]["WeiXinToken"] != null) && (set.Tables[0].Rows[0]["WeiXinToken"].ToString() != ""))
            {
                parameter.WeiXinToken = set.Tables[0].Rows[0]["WeiXinToken"].ToString();
            }
            if ((set.Tables[0].Rows[0]["WeiXinEncodingAESKey"] != null) && (set.Tables[0].Rows[0]["WeiXinEncodingAESKey"].ToString() != ""))
            {
                parameter.WeiXinEncodingAESKey = set.Tables[0].Rows[0]["WeiXinEncodingAESKey"].ToString();
            }
            if ((set.Tables[0].Rows[0]["WeiXinShopName"] != null) && (set.Tables[0].Rows[0]["WeiXinShopName"].ToString() != ""))
            {
                parameter.WeiXinShopName = set.Tables[0].Rows[0]["WeiXinShopName"].ToString();
            }
            if ((set.Tables[0].Rows[0]["WeiXinSalutatory"] != null) && (set.Tables[0].Rows[0]["WeiXinSalutatory"].ToString() != ""))
            {
                parameter.WeiXinSalutatory = set.Tables[0].Rows[0]["WeiXinSalutatory"].ToString();
            }
            if ((set.Tables[0].Rows[0]["WeiXinAppID"] != null) && (set.Tables[0].Rows[0]["WeiXinAppID"].ToString() != ""))
            {
                parameter.WeiXinAppID = set.Tables[0].Rows[0]["WeiXinAppID"].ToString();
            }
            if ((set.Tables[0].Rows[0]["WeiXinAppSecret"] != null) && (set.Tables[0].Rows[0]["WeiXinAppSecret"].ToString() != ""))
            {
                parameter.WeiXinAppSecret = set.Tables[0].Rows[0]["WeiXinAppSecret"].ToString();
            }
            if ((set.Tables[0].Rows[0]["SignInPoint"] != null) && (set.Tables[0].Rows[0]["SignInPoint"].ToString() != ""))
            {
                parameter.SignInPoint = int.Parse(set.Tables[0].Rows[0]["SignInPoint"].ToString());
            }
            if ((set.Tables[0].Rows[0]["IsMemRegisterStaff"] != null) && (set.Tables[0].Rows[0]["IsMemRegisterStaff"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsMemRegisterStaff"].ToString() == "1") || (set.Tables[0].Rows[0]["IsMemRegisterStaff"].ToString().ToLower() == "true"))
                {
                    parameter.IsMemRegisterStaff = true;
                }
                else
                {
                    parameter.IsMemRegisterStaff = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsMustSlotCard"] != null) && (set.Tables[0].Rows[0]["IsMustSlotCard"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsMustSlotCard"].ToString() == "1") || (set.Tables[0].Rows[0]["IsMustSlotCard"].ToString().ToLower() == "true"))
                {
                    parameter.IsMustSlotCard = true;
                }
                else
                {
                    parameter.IsMustSlotCard = false;
                }
            }
            if ((set.Tables[0].Rows[0]["StorageTimingPrefix"] != null) && (set.Tables[0].Rows[0]["StorageTimingPrefix"].ToString() != ""))
            {
                parameter.StorageTimingPrefix = set.Tables[0].Rows[0]["StorageTimingPrefix"].ToString();
            }
            if ((set.Tables[0].Rows[0]["IsAutoSendSMSByStorageTiming"] != null) && (set.Tables[0].Rows[0]["IsAutoSendSMSByStorageTiming"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsAutoSendSMSByStorageTiming"].ToString() == "1") || (set.Tables[0].Rows[0]["IsAutoSendSMSByStorageTiming"].ToString().ToLower() == "true"))
                {
                    parameter.IsAutoSendSMSByStorageTiming = true;
                }
                else
                {
                    parameter.IsAutoSendSMSByStorageTiming = false;
                }
            }
            if ((set.Tables[0].Rows[0]["EnterpriseEmailPort"] != null) && (set.Tables[0].Rows[0]["EnterpriseEmailPort"].ToString() != ""))
            {
                parameter.EnterpriseEmailPort = int.Parse(set.Tables[0].Rows[0]["EnterpriseEmailPort"].ToString());
            }
            if ((set.Tables[0].Rows[0]["EnterpriseEmailDisplayName"] != null) && (set.Tables[0].Rows[0]["EnterpriseEmailDisplayName"].ToString() != ""))
            {
                parameter.EnterpriseEmailDisplayName = set.Tables[0].Rows[0]["EnterpriseEmailDisplayName"].ToString();
            }
            if ((set.Tables[0].Rows[0]["EnterpriseEmailEnableSSL"] != null) && (set.Tables[0].Rows[0]["EnterpriseEmailEnableSSL"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["EnterpriseEmailEnableSSL"].ToString() == "1") || (set.Tables[0].Rows[0]["EnterpriseEmailEnableSSL"].ToString().ToLower() == "true"))
                {
                    parameter.EnterpriseEmailEnableSSL = true;
                }
                else
                {
                    parameter.EnterpriseEmailEnableSSL = false;
                }
            }
            if ((set.Tables[0].Rows[0]["EnterpriseEmailUseDefaultCredentials"] != null) && (set.Tables[0].Rows[0]["EnterpriseEmailUseDefaultCredentials"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["EnterpriseEmailUseDefaultCredentials"].ToString() == "1") || (set.Tables[0].Rows[0]["EnterpriseEmailUseDefaultCredentials"].ToString().ToLower() == "true"))
                {
                    parameter.EnterpriseEmailUseDefaultCredentials = true;
                }
                else
                {
                    parameter.EnterpriseEmailUseDefaultCredentials = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsEmail"] != null) && (set.Tables[0].Rows[0]["IsEmail"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsEmail"].ToString() == "1") || (set.Tables[0].Rows[0]["IsEmail"].ToString().ToLower() == "true"))
                {
                    parameter.IsEmail = true;
                }
                else
                {
                    parameter.IsEmail = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsEmailNotice"] != null) && (set.Tables[0].Rows[0]["IsEmailNotice"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsEmailNotice"].ToString() == "1") || (set.Tables[0].Rows[0]["IsEmailNotice"].ToString().ToLower() == "true"))
                {
                    parameter.IsEmailNotice = true;
                }
                else
                {
                    parameter.IsEmailNotice = false;
                }
            }
            if ((set.Tables[0].Rows[0]["MemCountExpensePrefix"] != null) && (set.Tables[0].Rows[0]["MemCountExpensePrefix"].ToString() != ""))
            {
                parameter.MemCountExpensePrefix = set.Tables[0].Rows[0]["MemCountExpensePrefix"].ToString();
            }
            if ((set.Tables[0].Rows[0]["IsAutoSendSMSByMemPast"] != null) && (set.Tables[0].Rows[0]["IsAutoSendSMSByMemPast"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsAutoSendSMSByMemPast"].ToString() == "1") || (set.Tables[0].Rows[0]["IsAutoSendSMSByMemPast"].ToString().ToLower() == "true"))
                {
                    parameter.IsAutoSendSMSByMemPast = true;
                }
                else
                {
                    parameter.IsAutoSendSMSByMemPast = false;
                }
            }
            if ((set.Tables[0].Rows[0]["AutoSendSMSByMemPastForDay"] != null) && (set.Tables[0].Rows[0]["AutoSendSMSByMemPastForDay"].ToString() != ""))
            {
                parameter.AutoSendSMSByMemPastForDay = int.Parse(set.Tables[0].Rows[0]["AutoSendSMSByMemPastForDay"].ToString());
            }
            if ((set.Tables[0].Rows[0]["IsAutoSendSMSByMemBirthday"] != null) && (set.Tables[0].Rows[0]["IsAutoSendSMSByMemBirthday"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsAutoSendSMSByMemBirthday"].ToString() == "1") || (set.Tables[0].Rows[0]["IsAutoSendSMSByMemBirthday"].ToString().ToLower() == "true"))
                {
                    parameter.IsAutoSendSMSByMemBirthday = true;
                }
                else
                {
                    parameter.IsAutoSendSMSByMemBirthday = false;
                }
            }
            if ((set.Tables[0].Rows[0]["AutoSendSMSByMemBirthdayForDay"] != null) && (set.Tables[0].Rows[0]["AutoSendSMSByMemBirthdayForDay"].ToString() != ""))
            {
                parameter.AutoSendSMSByMemBirthdayForDay = int.Parse(set.Tables[0].Rows[0]["AutoSendSMSByMemBirthdayForDay"].ToString());
            }
            if ((set.Tables[0].Rows[0]["IsStartWeiXin"] != null) && (set.Tables[0].Rows[0]["IsStartWeiXin"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsStartWeiXin"].ToString() == "1") || (set.Tables[0].Rows[0]["IsStartWeiXin"].ToString().ToLower() == "true"))
                {
                    parameter.IsStartWeiXin = true;
                }
                else
                {
                    parameter.IsStartWeiXin = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsStartTimingProject"] != null) && (set.Tables[0].Rows[0]["IsStartTimingProject"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsStartTimingProject"].ToString() == "1") || (set.Tables[0].Rows[0]["IsStartTimingProject"].ToString().ToLower() == "true"))
                {
                    parameter.IsStartTimingProject = true;
                }
                else
                {
                    parameter.IsStartTimingProject = false;
                }
            }
            if ((set.Tables[0].Rows[0]["IsStartMemCount"] != null) && (set.Tables[0].Rows[0]["IsStartMemCount"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsStartMemCount"].ToString() == "1") || (set.Tables[0].Rows[0]["IsStartMemCount"].ToString().ToLower() == "true"))
                {
                    parameter.IsStartMemCount = true;
                }
                else
                {
                    parameter.IsStartMemCount = false;
                }
            }
            if ((set.Tables[0].Rows[0]["MarketingSMS"] != null) && (set.Tables[0].Rows[0]["MarketingSMS"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["MarketingSMS"].ToString() == "1") || (set.Tables[0].Rows[0]["MarketingSMS"].ToString().ToLower() == "true"))
                {
                    parameter.MarketingSMS = true;
                }
                else
                {
                    parameter.MarketingSMS = false;
                }
            }
            if ((set.Tables[0].Rows[0]["MarketingSmsSeries"] != null) && (set.Tables[0].Rows[0]["MarketingSmsSeries"].ToString() != ""))
            {
                parameter.MarketingSmsSeries = set.Tables[0].Rows[0]["MarketingSmsSeries"].ToString();
            }
            if ((set.Tables[0].Rows[0]["MarketingSmsSerialPwd"] != null) && (set.Tables[0].Rows[0]["MarketingSmsSerialPwd"].ToString() != ""))
            {
                parameter.MarketingSmsSerialPwd = set.Tables[0].Rows[0]["MarketingSmsSerialPwd"].ToString();
            }
            if ((set.Tables[0].Rows[0]["Senseiccard"] != null) && (set.Tables[0].Rows[0]["Senseiccard"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["Senseiccard"].ToString() == "1") || (set.Tables[0].Rows[0]["Senseiccard"].ToString().ToLower() == "true"))
                {
                    parameter.Senseiccard = true;
                }
                else
                {
                    parameter.Senseiccard = false;
                }
            }
            if ((set.Tables[0].Rows[0]["Contacticcard"] != null) && (set.Tables[0].Rows[0]["Contacticcard"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["Contacticcard"].ToString() == "1") || (set.Tables[0].Rows[0]["Contacticcard"].ToString().ToLower() == "true"))
                {
                    parameter.Contacticcard = true;
                }
                else
                {
                    parameter.Contacticcard = false;
                }
            }
            if ((set.Tables[0].Rows[0]["EmailUserName"] != null) && (set.Tables[0].Rows[0]["EmailUserName"].ToString() != ""))
            {
                parameter.EmailUserName = set.Tables[0].Rows[0]["EmailUserName"].ToString();
            }
            if ((set.Tables[0].Rows[0]["PointNumStr"] != null) && (set.Tables[0].Rows[0]["PointNumStr"].ToString() != ""))
            {
                parameter.PointNumStr = set.Tables[0].Rows[0]["PointNumStr"].ToString();
            }
            if ((set.Tables[0].Rows[0]["PrintPreview"] != null) && (set.Tables[0].Rows[0]["PrintPreview"].ToString() != ""))
            {
                parameter.PrintPreview = int.Parse(set.Tables[0].Rows[0]["PrintPreview"].ToString());
            }
            if ((set.Tables[0].Rows[0]["PrintPaperType"] != null) && (set.Tables[0].Rows[0]["PrintPaperType"].ToString() != ""))
            {
                parameter.PrintPaperType = int.Parse(set.Tables[0].Rows[0]["PrintPaperType"].ToString());
            }
            if ((set.Tables[0].Rows[0]["IsSendCard"] != null) && (set.Tables[0].Rows[0]["IsSendCard"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["IsSendCard"].ToString() == "1") || (set.Tables[0].Rows[0]["IsSendCard"].ToString().ToLower() == "true"))
                {
                    parameter.IsSendCard = true;
                }
                else
                {
                    parameter.IsSendCard = false;
                }
            }
            if ((set.Tables[0].Rows[0]["ShopSmsManage"] != null) && (set.Tables[0].Rows[0]["ShopSmsManage"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["ShopSmsManage"].ToString() == "1") || (set.Tables[0].Rows[0]["ShopSmsManage"].ToString().ToLower() == "true"))
                {
                    parameter.ShopSmsManage = true;
                }
                else
                {
                    parameter.ShopSmsManage = false;
                }
            }
            if ((set.Tables[0].Rows[0]["ShopPointManage"] != null) && (set.Tables[0].Rows[0]["ShopPointManage"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["ShopPointManage"].ToString() == "1") || (set.Tables[0].Rows[0]["ShopPointManage"].ToString().ToLower() == "true"))
                {
                    parameter.ShopPointManage = true;
                }
                else
                {
                    parameter.ShopPointManage = false;
                }
            }
            if ((set.Tables[0].Rows[0]["ShopSettlement"] != null) && (set.Tables[0].Rows[0]["ShopSettlement"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["ShopSettlement"].ToString() == "1") || (set.Tables[0].Rows[0]["ShopSettlement"].ToString().ToLower() == "true"))
                {
                    parameter.ShopSettlement = true;
                }
                else
                {
                    parameter.ShopSettlement = false;
                }
            }
            if ((set.Tables[0].Rows[0]["AutoBackupDB"] != null) && (set.Tables[0].Rows[0]["AutoBackupDB"].ToString() != ""))
            {
                if ((set.Tables[0].Rows[0]["AutoBackupDB"].ToString() == "1") || (set.Tables[0].Rows[0]["AutoBackupDB"].ToString().ToLower() == "true"))
                {
                    parameter.AutoBackupDB = true;
                }
                else
                {
                    parameter.AutoBackupDB = false;
                }
            }
            if ((set.Tables[0].Rows[0]["AutoBackupDay"] != null) && (set.Tables[0].Rows[0]["AutoBackupDay"].ToString() != ""))
            {
                parameter.AutoBackupDay = int.Parse(set.Tables[0].Rows[0]["AutoBackupDay"].ToString());
            }
            if ((set.Tables[0].Rows[0]["SystemDomain"] != null) && (set.Tables[0].Rows[0]["SystemDomain"].ToString() != ""))
            {
                parameter.SystemDomain = set.Tables[0].Rows[0]["SystemDomain"].ToString();
            }
            return parameter;
        }

        public int GetRecordCount(string strWhere)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("select count(1) FROM SysParameter ");
            if (strWhere.Trim() != "")
            {
                builder.Append(" where " + strWhere);
            }
            object single = DbHelperSQL.GetSingle(builder.ToString());
            if (single == null)
            {
                return 0;
            }
            return Convert.ToInt32(single);
        }

        public int ReductionDataBakUp(string FileName)
        {
            if (!DbHelperSQL.DataBaseRecover(FileName))
            {
                return 0;
            }
            try
            {
                this.GetMaxId();
            }
            catch
            {
            }
            return 1;
        }

        public bool SwitchingMode(List<bool> Status, List<string> ModuleIDs)
        {
            StringBuilder builder = new StringBuilder();
            for (int i = 0; i < Status.Count; i++)
            {
                builder.AppendFormat("update SysModule set ModuleVisible='{0}' where ModuleID in ({1});", Status[i].ToString(), ModuleIDs[i]);
                if (Status[i])
                {
                    builder.AppendFormat("update SysGroupAuthority set ActionValue='{0}' where  ModuleID in ({1}) and GroupID=1 ;", Status[i].ToString(), ModuleIDs[i]);
                }
                else
                {
                    builder.AppendFormat("update SysGroupAuthority set ActionValue='{0}' where  ModuleID in ({1});", Status[i].ToString(), ModuleIDs[i]);
                }
            }
            return (DbHelperSQL.ExecuteSql(builder.ToString()) > 0);
        }

        public bool Update(Chain.Model.SysParameter model)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("update SysParameter set ");
            builder.Append("Pwd=@Pwd,");
            builder.Append("MoneyAndPoint=@MoneyAndPoint,");
            builder.Append("AutoLevel=@AutoLevel,");
            builder.Append("DegradeLevel=@DegradeLevel,");
            builder.Append("PastTime=@PastTime,");
            builder.Append("RecommendPoint=@RecommendPoint,");
            builder.Append("PointPeriod=@PointPeriod,");
            builder.Append("ExpensePrefix=@ExpensePrefix,");
            builder.Append("GoodsExpensePrefix=@GoodsExpensePrefix,");
            builder.Append("TimeExpensePrefix=@TimeExpensePrefix,");
            builder.Append("MemCountPrefix=@MemCountPrefix,");
            builder.Append("MemRechargePrefix=@MemRechargePrefix,");
            builder.Append("GoodsInPrefix=@GoodsInPrefix,");
            builder.Append("GoodsAllotPrefix=@GoodsAllotPrefix,");
            builder.Append("MemDrawMoneyPrefix=@MemDrawMoneyPrefix,");
            builder.Append("MemPointChangePrefix=@MemPointChangePrefix,");
            builder.Append("GiftExchangePrefix=@GiftExchangePrefix,");
            builder.Append("AutoPrint=@AutoPrint,");
            builder.Append("AccordPrint=@AccordPrint,");
            builder.Append("PrintTitle=@PrintTitle,");
            builder.Append("PrintFootNote=@PrintFootNote,");
            builder.Append("Sms=@Sms,");
            builder.Append("MoneySms=@MoneySms,");
            builder.Append("IsSmsShopName=@IsSmsShopName,");
            builder.Append("SmsShopName=@SmsShopName,");
            builder.Append("SmsSeries=@SmsSeries,");
            builder.Append("SmsSerialPwd=@SmsSerialPwd,");
            builder.Append("DrawMoneyPercent=@DrawMoneyPercent,");
            builder.Append("Tel=@Tel,");
            builder.Append("TelNoMember=@TelNoMember,");
            builder.Append("IsStaff=@IsStaff,");
            builder.Append("StaffType=@StaffType,");
            builder.Append("PointLevel=@PointLevel,");
            builder.Append("MMS=@MMS,");
            builder.Append("MMSSeries=@MMSSeries,");
            builder.Append("MMSSerialPwd=@MMSSerialPwd,");
            builder.Append("IsPayCard=@IsPayCard,");
            builder.Append("IsPayCash=@IsPayCash,");
            builder.Append("IsPayBink=@IsPayBink,");
            builder.Append("IsPayCoupon=@IsPayCoupon,");
            builder.Append("RegNullPwd=@RegNullPwd,");
            builder.Append("EmailAdress=@EmailAdress,");
            builder.Append("EmailPwd=@EmailPwd,");
            builder.Append("EmailSMTP=@EmailSMTP,");
            builder.Append("StockCount=@StockCount,");
            builder.Append("UnitList=@UnitList,");
            builder.Append("WeiXinSMSVcode=@WeiXinSMSVcode,");
            builder.Append("IsAutoSendSMSByMemRegister=@IsAutoSendSMSByMemRegister,");
            builder.Append("IsAutoSendMMSByMemRegister=@IsAutoSendMMSByMemRegister,");
            builder.Append("IsAutoSendSMSByMemRecharge=@IsAutoSendSMSByMemRecharge,");
            builder.Append("IsAutoSendSMSByMemWithdraw=@IsAutoSendSMSByMemWithdraw,");
            builder.Append("IsAutoSendSMSByMemGiftExchange=@IsAutoSendSMSByMemGiftExchange,");
            builder.Append("IsAutoSendSMSByMemPointChange=@IsAutoSendSMSByMemPointChange,");
            builder.Append("IsAutoSendSMSByCommodityConsumption=@IsAutoSendSMSByCommodityConsumption,");
            builder.Append("IsAutoSendSMSByFastConsumption=@IsAutoSendSMSByFastConsumption,");
            builder.Append("IsAutoSendSMSByMemRedTimes=@IsAutoSendSMSByMemRedTimes,");
            builder.Append("IsAutoSendSMSByTimingConsumption=@IsAutoSendSMSByTimingConsumption,");
            builder.Append("SellerAccount=@SellerAccount,");
            builder.Append("PartnerID=@PartnerID,");
            builder.Append("PartnerKey=@PartnerKey,");
            builder.Append("IsEditPwdNeedOldPwd=@IsEditPwdNeedOldPwd,");
            builder.Append("WeiXinType=@WeiXinType,");
            builder.Append("WeiXinVerified=@WeiXinVerified,");
            builder.Append("WeiXinToken=@WeiXinToken,");
            builder.Append("WeiXinEncodingAESKey=@WeiXinEncodingAESKey,");
            builder.Append("WeiXinShopName=@WeiXinShopName,");
            builder.Append("WeiXinSalutatory=@WeiXinSalutatory,");
            builder.Append("WeiXinAppID=@WeiXinAppID,");
            builder.Append("WeiXinAppSecret=@WeiXinAppSecret,");
            builder.Append("SignInPoint=@SignInPoint,");
            builder.Append("IsMemRegisterStaff=@IsMemRegisterStaff,");
            builder.Append("IsMustSlotCard=@IsMustSlotCard,");
            builder.Append("StorageTimingPrefix=@StorageTimingPrefix,");
            builder.Append("IsAutoSendSMSByStorageTiming=@IsAutoSendSMSByStorageTiming,");
            builder.Append("EnterpriseEmailPort=@EnterpriseEmailPort,");
            builder.Append("EnterpriseEmailDisplayName=@EnterpriseEmailDisplayName,");
            builder.Append("EnterpriseEmailEnableSSL=@EnterpriseEmailEnableSSL,");
            builder.Append("EnterpriseEmailUseDefaultCredentials=@EnterpriseEmailUseDefaultCredentials,");
            builder.Append("IsEmail=@IsEmail,");
            builder.Append("IsEmailNotice=@IsEmailNotice,");
            builder.Append("MemCountExpensePrefix=@MemCountExpensePrefix,");
            builder.Append("IsAutoSendSMSByMemPast=@IsAutoSendSMSByMemPast,");
            builder.Append("AutoSendSMSByMemPastForDay=@AutoSendSMSByMemPastForDay,");
            builder.Append("IsAutoSendSMSByMemBirthday=@IsAutoSendSMSByMemBirthday,");
            builder.Append("AutoSendSMSByMemBirthdayForDay=@AutoSendSMSByMemBirthdayForDay,");
            builder.Append("IsStartWeiXin=@IsStartWeiXin,");
            builder.Append("IsStartTimingProject=@IsStartTimingProject,");
            builder.Append("IsStartMemCount=@IsStartMemCount,");
            builder.Append("MarketingSMS=@MarketingSMS,");
            builder.Append("MarketingSmsSeries=@MarketingSmsSeries,");
            builder.Append("MarketingSmsSerialPwd=@MarketingSmsSerialPwd,");
            builder.Append("Senseiccard=@Senseiccard,");
            builder.Append("Contacticcard=@Contacticcard,");
            builder.Append("EmailUserName=@EmailUserName,");
            builder.Append("PointNumStr=@PointNumStr,");
            builder.Append("PrintPreview=@PrintPreview,");
            builder.Append("PrintPaperType=@PrintPaperType,");
            builder.Append("IsSendCard=@IsSendCard,");
            builder.Append("ShopSmsManage=@ShopSmsManage,");
            builder.Append("ShopPointManage=@ShopPointManage,");
            builder.Append("ShopSettlement=@ShopSettlement,");
            builder.Append("AutoBackupDB=@AutoBackupDB,");
            builder.Append("AutoBackupDay=@AutoBackupDay,");
            builder.Append("SystemDomain=@SystemDomain");
            builder.Append(" where ParameterID=@ParameterID");
            SqlParameter[] cmdParms = new SqlParameter[] { 
                new SqlParameter("@Pwd", SqlDbType.Bit, 1), new SqlParameter("@MoneyAndPoint", SqlDbType.Bit, 1), new SqlParameter("@AutoLevel", SqlDbType.Bit, 1), new SqlParameter("@DegradeLevel", SqlDbType.Bit, 1), new SqlParameter("@PastTime", SqlDbType.Bit, 1), new SqlParameter("@RecommendPoint", SqlDbType.Int, 4), new SqlParameter("@PointPeriod", SqlDbType.Int, 4), new SqlParameter("@ExpensePrefix", SqlDbType.VarChar, 50), new SqlParameter("@GoodsExpensePrefix", SqlDbType.VarChar, 50), new SqlParameter("@TimeExpensePrefix", SqlDbType.VarChar, 50), new SqlParameter("@MemCountPrefix", SqlDbType.VarChar, 50), new SqlParameter("@MemRechargePrefix", SqlDbType.VarChar, 50), new SqlParameter("@GoodsInPrefix", SqlDbType.VarChar, 50), new SqlParameter("@GoodsAllotPrefix", SqlDbType.VarChar, 50), new SqlParameter("@MemDrawMoneyPrefix", SqlDbType.VarChar, 50), new SqlParameter("@MemPointChangePrefix", SqlDbType.VarChar, 50), 
                new SqlParameter("@GiftExchangePrefix", SqlDbType.VarChar, 50), new SqlParameter("@AutoPrint", SqlDbType.Bit, 1), new SqlParameter("@AccordPrint", SqlDbType.Bit, 1), new SqlParameter("@PrintTitle", SqlDbType.NVarChar, 100), new SqlParameter("@PrintFootNote", SqlDbType.NVarChar, 100), new SqlParameter("@Sms", SqlDbType.Bit, 1), new SqlParameter("@MoneySms", SqlDbType.Bit, 1), new SqlParameter("@IsSmsShopName", SqlDbType.Bit, 1), new SqlParameter("@SmsShopName", SqlDbType.NVarChar, 100), new SqlParameter("@SmsSeries", SqlDbType.VarChar, 50), new SqlParameter("@SmsSerialPwd", SqlDbType.VarChar, 50), new SqlParameter("@DrawMoneyPercent", SqlDbType.Decimal, 9), new SqlParameter("@Tel", SqlDbType.Bit, 1), new SqlParameter("@TelNoMember", SqlDbType.Bit, 1), new SqlParameter("@IsStaff", SqlDbType.Bit, 1), new SqlParameter("@StaffType", SqlDbType.Bit, 1), 
                new SqlParameter("@PointLevel", SqlDbType.Bit, 1), new SqlParameter("@MMS", SqlDbType.Bit, 1), new SqlParameter("@MMSSeries", SqlDbType.VarChar, 50), new SqlParameter("@MMSSerialPwd", SqlDbType.VarChar, 50), new SqlParameter("@IsPayCard", SqlDbType.Bit, 1), new SqlParameter("@IsPayCash", SqlDbType.Bit, 1), new SqlParameter("@IsPayBink", SqlDbType.Bit, 1), new SqlParameter("@IsPayCoupon", SqlDbType.Bit, 1), new SqlParameter("@RegNullPwd", SqlDbType.Bit, 1), new SqlParameter("@EmailAdress", SqlDbType.NVarChar, 100), new SqlParameter("@EmailPwd", SqlDbType.NVarChar, 100), new SqlParameter("@EmailSMTP", SqlDbType.NVarChar, 100), new SqlParameter("@StockCount", SqlDbType.Int, 4), new SqlParameter("@UnitList", SqlDbType.NVarChar, 200), new SqlParameter("@WeiXinSMSVcode", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByMemRegister", SqlDbType.Bit, 1), 
                new SqlParameter("@IsAutoSendMMSByMemRegister", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByMemRecharge", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByMemWithdraw", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByMemGiftExchange", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByMemPointChange", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByCommodityConsumption", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByFastConsumption", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByMemRedTimes", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByTimingConsumption", SqlDbType.Bit, 1), new SqlParameter("@SellerAccount", SqlDbType.VarChar, 50), new SqlParameter("@PartnerID", SqlDbType.VarChar, 50), new SqlParameter("@PartnerKey", SqlDbType.VarChar, 50), new SqlParameter("@IsEditPwdNeedOldPwd", SqlDbType.Bit, 1), new SqlParameter("@WeiXinType", SqlDbType.Bit, 1), new SqlParameter("@WeiXinVerified", SqlDbType.Bit, 1), new SqlParameter("@WeiXinToken", SqlDbType.NVarChar, 100), 
                new SqlParameter("@WeiXinEncodingAESKey", SqlDbType.NVarChar, 100), new SqlParameter("@WeiXinShopName", SqlDbType.NVarChar, 100), new SqlParameter("@WeiXinSalutatory", SqlDbType.NVarChar, 0x3e8), new SqlParameter("@WeiXinAppID", SqlDbType.NVarChar, 0x3e8), new SqlParameter("@WeiXinAppSecret", SqlDbType.NVarChar, 0x3e8), new SqlParameter("@SignInPoint", SqlDbType.Int, 4), new SqlParameter("@IsMemRegisterStaff", SqlDbType.Bit, 1), new SqlParameter("@IsMustSlotCard", SqlDbType.Bit, 1), new SqlParameter("@StorageTimingPrefix", SqlDbType.NVarChar, 50), new SqlParameter("@IsAutoSendSMSByStorageTiming", SqlDbType.Bit, 1), new SqlParameter("@EnterpriseEmailPort", SqlDbType.Int, 4), new SqlParameter("@EnterpriseEmailDisplayName", SqlDbType.NVarChar, 100), new SqlParameter("@EnterpriseEmailEnableSSL", SqlDbType.Bit, 1), new SqlParameter("@EnterpriseEmailUseDefaultCredentials", SqlDbType.Bit, 1), new SqlParameter("@IsEmail", SqlDbType.Bit, 1), new SqlParameter("@IsEmailNotice", SqlDbType.Bit, 1), 
                new SqlParameter("@MemCountExpensePrefix", SqlDbType.VarChar, 50), new SqlParameter("@IsAutoSendSMSByMemPast", SqlDbType.Bit, 1), new SqlParameter("@AutoSendSMSByMemPastForDay", SqlDbType.Int, 4), new SqlParameter("@IsAutoSendSMSByMemBirthday", SqlDbType.Bit, 1), new SqlParameter("@AutoSendSMSByMemBirthdayForDay", SqlDbType.Int, 4), new SqlParameter("@IsStartWeiXin", SqlDbType.Bit, 1), new SqlParameter("@IsStartTimingProject", SqlDbType.Bit, 1), new SqlParameter("@IsStartMemCount", SqlDbType.Bit, 1), new SqlParameter("@MarketingSMS", SqlDbType.Bit, 1), new SqlParameter("@MarketingSmsSeries", SqlDbType.VarChar, 50), new SqlParameter("@MarketingSmsSerialPwd", SqlDbType.VarChar, 50), new SqlParameter("@Senseiccard", SqlDbType.Bit, 1), new SqlParameter("@Contacticcard", SqlDbType.Bit, 1), new SqlParameter("@EmailUserName", SqlDbType.NVarChar, 50), new SqlParameter("@PointNumStr", SqlDbType.VarChar, 100), new SqlParameter("@PrintPreview", SqlDbType.Int, 4), 
                new SqlParameter("@PrintPaperType", SqlDbType.Int, 4), new SqlParameter("@IsSendCard", SqlDbType.Bit, 1), new SqlParameter("@ShopSmsManage", SqlDbType.Bit, 1), new SqlParameter("@ShopPointManage", SqlDbType.Bit, 1), new SqlParameter("@ShopSettlement", SqlDbType.Bit, 1), new SqlParameter("@AutoBackupDB", SqlDbType.Bit, 1), new SqlParameter("@AutoBackupDay", SqlDbType.Int, 4), new SqlParameter("@SystemDomain", SqlDbType.VarChar, 100), new SqlParameter("@ParameterID", SqlDbType.Int, 4)
             };
            cmdParms[0].Value = model.Pwd;
            cmdParms[1].Value = model.MoneyAndPoint;
            cmdParms[2].Value = model.AutoLevel;
            cmdParms[3].Value = model.DegradeLevel;
            cmdParms[4].Value = model.PastTime;
            cmdParms[5].Value = model.RecommendPoint;
            cmdParms[6].Value = model.PointPeriod;
            cmdParms[7].Value = model.ExpensePrefix;
            cmdParms[8].Value = model.GoodsExpensePrefix;
            cmdParms[9].Value = model.TimeExpensePrefix;
            cmdParms[10].Value = model.MemCountPrefix;
            cmdParms[11].Value = model.MemRechargePrefix;
            cmdParms[12].Value = model.GoodsInPrefix;
            cmdParms[13].Value = model.GoodsAllotPrefix;
            cmdParms[14].Value = model.MemDrawMoneyPrefix;
            cmdParms[15].Value = model.MemPointChangePrefix;
            cmdParms[0x10].Value = model.GiftExchangePrefix;
            cmdParms[0x11].Value = model.AutoPrint;
            cmdParms[0x12].Value = model.AccordPrint;
            cmdParms[0x13].Value = model.PrintTitle;
            cmdParms[20].Value = model.PrintFootNote;
            cmdParms[0x15].Value = model.Sms;
            cmdParms[0x16].Value = model.MoneySms;
            cmdParms[0x17].Value = model.IsSmsShopName;
            cmdParms[0x18].Value = model.SmsShopName;
            cmdParms[0x19].Value = model.SmsSeries;
            cmdParms[0x1a].Value = model.SmsSerialPwd;
            cmdParms[0x1b].Value = model.DrawMoneyPercent;
            cmdParms[0x1c].Value = model.Tel;
            cmdParms[0x1d].Value = model.TelNoMember;
            cmdParms[30].Value = model.IsStaff;
            cmdParms[0x1f].Value = model.StaffType;
            cmdParms[0x20].Value = model.PointLevel;
            cmdParms[0x21].Value = model.MMS;
            cmdParms[0x22].Value = model.MMSSeries;
            cmdParms[0x23].Value = model.MMSSerialPwd;
            cmdParms[0x24].Value = model.IsPayCard;
            cmdParms[0x25].Value = model.IsPayCash;
            cmdParms[0x26].Value = model.IsPayBink;
            cmdParms[0x27].Value = model.IsPayCoupon;
            cmdParms[40].Value = model.RegNullPwd;
            cmdParms[0x29].Value = model.EmailAdress;
            cmdParms[0x2a].Value = model.EmailPwd;
            cmdParms[0x2b].Value = model.EmailSMTP;
            cmdParms[0x2c].Value = model.StockCount;
            cmdParms[0x2d].Value = model.UnitList;
            cmdParms[0x2e].Value = model.WeiXinSMSVcode;
            cmdParms[0x2f].Value = model.IsAutoSendSMSByMemRegister;
            cmdParms[0x30].Value = model.IsAutoSendMMSByMemRegister;
            cmdParms[0x31].Value = model.IsAutoSendSMSByMemRecharge;
            cmdParms[50].Value = model.IsAutoSendSMSByMemWithdraw;
            cmdParms[0x33].Value = model.IsAutoSendSMSByMemGiftExchange;
            cmdParms[0x34].Value = model.IsAutoSendSMSByMemPointChange;
            cmdParms[0x35].Value = model.IsAutoSendSMSByCommodityConsumption;
            cmdParms[0x36].Value = model.IsAutoSendSMSByFastConsumption;
            cmdParms[0x37].Value = model.IsAutoSendSMSByMemRedTimes;
            cmdParms[0x38].Value = model.IsAutoSendSMSByTimingConsumption;
            cmdParms[0x39].Value = model.SellerAccount;
            cmdParms[0x3a].Value = model.PartnerID;
            cmdParms[0x3b].Value = model.PartnerKey;
            cmdParms[60].Value = model.IsEditPwdNeedOldPwd;
            cmdParms[0x3d].Value = model.WeiXinType;
            cmdParms[0x3e].Value = model.WeiXinVerified;
            cmdParms[0x3f].Value = model.WeiXinToken;
            cmdParms[0x40].Value = model.WeiXinEncodingAESKey;
            cmdParms[0x41].Value = model.WeiXinShopName;
            cmdParms[0x42].Value = model.WeiXinSalutatory;
            cmdParms[0x43].Value = model.WeiXinAppID;
            cmdParms[0x44].Value = model.WeiXinAppSecret;
            cmdParms[0x45].Value = model.SignInPoint;
            cmdParms[70].Value = model.IsMemRegisterStaff;
            cmdParms[0x47].Value = model.IsMustSlotCard;
            cmdParms[0x48].Value = model.StorageTimingPrefix;
            cmdParms[0x49].Value = model.IsAutoSendSMSByStorageTiming;
            cmdParms[0x4a].Value = model.EnterpriseEmailPort;
            cmdParms[0x4b].Value = model.EnterpriseEmailDisplayName;
            cmdParms[0x4c].Value = model.EnterpriseEmailEnableSSL;
            cmdParms[0x4d].Value = model.EnterpriseEmailUseDefaultCredentials;
            cmdParms[0x4e].Value = model.IsEmail;
            cmdParms[0x4f].Value = model.IsEmailNotice;
            cmdParms[80].Value = model.MemCountExpensePrefix;
            cmdParms[0x51].Value = model.IsAutoSendSMSByMemPast;
            cmdParms[0x52].Value = model.AutoSendSMSByMemPastForDay;
            cmdParms[0x53].Value = model.IsAutoSendSMSByMemBirthday;
            cmdParms[0x54].Value = model.AutoSendSMSByMemBirthdayForDay;
            cmdParms[0x55].Value = model.IsStartWeiXin;
            cmdParms[0x56].Value = model.IsStartTimingProject;
            cmdParms[0x57].Value = model.IsStartMemCount;
            cmdParms[0x58].Value = model.MarketingSMS;
            cmdParms[0x59].Value = model.MarketingSmsSeries;
            cmdParms[90].Value = model.MarketingSmsSerialPwd;
            cmdParms[0x5b].Value = model.Senseiccard;
            cmdParms[0x5c].Value = model.Contacticcard;
            cmdParms[0x5d].Value = model.EmailUserName;
            cmdParms[0x5e].Value = model.PointNumStr;
            cmdParms[0x5f].Value = model.PrintPreview;
            cmdParms[0x60].Value = model.PrintPaperType;
            cmdParms[0x61].Value = model.IsSendCard;
            cmdParms[0x62].Value = model.ShopSmsManage;
            cmdParms[0x63].Value = model.ShopPointManage;
            cmdParms[100].Value = model.ShopSettlement;
            cmdParms[0x65].Value = model.AutoBackupDB;
            cmdParms[0x66].Value = model.AutoBackupDay;
            cmdParms[0x67].Value = model.SystemDomain;
            cmdParms[0x68].Value = model.ParameterID;
            return (DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }

        public bool UpdateExtraParameter(Chain.Model.SysParameter model)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("update SysParameter set ");
            builder.Append("Sms=@Sms,");
            builder.Append("MoneySms=@MoneySms,");
            builder.Append("IsSmsShopName=@IsSmsShopName,");
            builder.Append("SmsShopName=@SmsShopName,");
            builder.Append("SmsSeries=@SmsSeries,");
            builder.Append("SmsSerialPwd=@SmsSerialPwd,");
            builder.Append("Tel=@Tel,");
            builder.Append("TelNoMember=@TelNoMember,");
            builder.Append("MMS=@MMS,");
            builder.Append("MMSSeries=@MMSSeries,");
            builder.Append("MMSSerialPwd=@MMSSerialPwd,");
            builder.Append("StockCount=@StockCount,");
            builder.Append("UnitList=@UnitList,");
            builder.Append("IsAutoSendSMSByMemRegister=@IsAutoSendSMSByMemRegister,");
            builder.Append("IsAutoSendMMSByMemRegister=@IsAutoSendMMSByMemRegister,");
            builder.Append("IsAutoSendSMSByMemRecharge=@IsAutoSendSMSByMemRecharge,");
            builder.Append("IsAutoSendSMSByMemWithdraw=@IsAutoSendSMSByMemWithdraw,");
            builder.Append("IsAutoSendSMSByMemGiftExchange=@IsAutoSendSMSByMemGiftExchange,");
            builder.Append("IsAutoSendSMSByMemPointChange=@IsAutoSendSMSByMemPointChange,");
            builder.Append("IsAutoSendSMSByCommodityConsumption=@IsAutoSendSMSByCommodityConsumption,");
            builder.Append("IsAutoSendSMSByFastConsumption=@IsAutoSendSMSByFastConsumption,");
            builder.Append("IsAutoSendSMSByMemRedTimes=@IsAutoSendSMSByMemRedTimes,");
            builder.Append("IsAutoSendSMSByTimingConsumption=@IsAutoSendSMSByTimingConsumption,");
            builder.Append("IsAutoSendSMSByStorageTiming=@IsAutoSendSMSByStorageTiming,");
            builder.Append("MarketingSMS=@MarketingSMS,");
            builder.Append("MarketingSmsSeries=@MarketingSmsSeries,");
            builder.Append("MarketingSmsSerialPwd=@MarketingSmsSerialPwd");
            builder.Append(" where ParameterID=@ParameterID");
            SqlParameter[] cmdParms = new SqlParameter[] { 
                new SqlParameter("@Sms", SqlDbType.Bit, 1), new SqlParameter("@MoneySms", SqlDbType.Bit, 1), new SqlParameter("@IsSmsShopName", SqlDbType.Bit, 1), new SqlParameter("@SmsShopName", SqlDbType.NVarChar, 100), new SqlParameter("@SmsSeries", SqlDbType.VarChar, 50), new SqlParameter("@SmsSerialPwd", SqlDbType.VarChar, 50), new SqlParameter("@Tel", SqlDbType.Bit, 1), new SqlParameter("@TelNoMember", SqlDbType.Bit, 1), new SqlParameter("@MMS", SqlDbType.Bit), new SqlParameter("@MMSSeries", SqlDbType.VarChar, 50), new SqlParameter("@MMSSerialPwd", SqlDbType.VarChar, 50), new SqlParameter("@StockCount", SqlDbType.Int, 4), new SqlParameter("@UnitList", SqlDbType.NVarChar, 200), new SqlParameter("@IsAutoSendSMSByMemRegister", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendMMSByMemRegister", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByMemRecharge", SqlDbType.Bit, 1), 
                new SqlParameter("@IsAutoSendSMSByMemWithdraw", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByMemGiftExchange", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByMemPointChange", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByCommodityConsumption", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByFastConsumption", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByMemRedTimes", SqlDbType.Bit, 1), new SqlParameter("@IsAutoSendSMSByTimingConsumption", SqlDbType.Bit, 1), new SqlParameter("@ParameterID", SqlDbType.Int, 4), new SqlParameter("@IsAutoSendSMSByStorageTiming", SqlDbType.Bit), new SqlParameter("@MarketingSMS", SqlDbType.Bit), new SqlParameter("@MarketingSmsSeries", SqlDbType.VarChar, 50), new SqlParameter("@MarketingSmsSerialPwd", SqlDbType.VarChar, 50)
             };
            cmdParms[0].Value = model.Sms;
            cmdParms[1].Value = model.MoneySms;
            cmdParms[2].Value = model.IsSmsShopName;
            cmdParms[3].Value = model.SmsShopName;
            cmdParms[4].Value = model.SmsSeries;
            cmdParms[5].Value = model.SmsSerialPwd;
            cmdParms[6].Value = model.Tel;
            cmdParms[7].Value = model.TelNoMember;
            cmdParms[8].Value = model.MMS;
            cmdParms[9].Value = model.MMSSeries;
            cmdParms[10].Value = model.MMSSerialPwd;
            cmdParms[11].Value = model.StockCount;
            cmdParms[12].Value = model.UnitList;
            cmdParms[13].Value = model.IsAutoSendSMSByMemRegister;
            cmdParms[14].Value = model.IsAutoSendMMSByMemRegister;
            cmdParms[15].Value = model.IsAutoSendSMSByMemRecharge;
            cmdParms[0x10].Value = model.IsAutoSendSMSByMemWithdraw;
            cmdParms[0x11].Value = model.IsAutoSendSMSByMemGiftExchange;
            cmdParms[0x12].Value = model.IsAutoSendSMSByMemPointChange;
            cmdParms[0x13].Value = model.IsAutoSendSMSByCommodityConsumption;
            cmdParms[20].Value = model.IsAutoSendSMSByFastConsumption;
            cmdParms[0x15].Value = model.IsAutoSendSMSByMemRedTimes;
            cmdParms[0x16].Value = model.IsAutoSendSMSByTimingConsumption;
            cmdParms[0x17].Value = model.ParameterID;
            cmdParms[0x18].Value = model.IsAutoSendSMSByStorageTiming;
            cmdParms[0x19].Value = model.MarketingSMS;
            cmdParms[0x1a].Value = model.MarketingSmsSeries;
            cmdParms[0x1b].Value = model.MarketingSmsSerialPwd;
            return (DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
    }
}

